{% extends 'ClassroomBundle:ClassroomManage:layout.html.twig' %}

{% set side_nav = "price" %}
{% set script_controller = 'classroombundle/controller/classroom/set-price' %}

{% block title %}基本信息 - {{ parent() }}{% endblock %}

{% block main %}
<div class="panel panel-default panel-col">
  <div class="panel-heading">基本信息</div>
  <div class="panel-body">
  {{ web_macro.flash_messages() }}
  <form class="form-horizontal" method="post" id="classroom-set-form" novalidate>

      <div class="row form-group">
        <div class="col-md-2 control-label">
          <label for="price">价格(元)</label>
        </div>
        <div class="controls col-md-8">
          <input name="price" type="text"  id="price" class="form-control" value="{{classroom.price}}"/>
          <div class="help-block">当前共有 {{courseNum}} 个课程，原价共计 {{price}} 元。</div>
        </div>
      {% if setting('coin.coin_enabled') and setting('coin.price_type') == 'Coin' %}
        <div class="controls col-md-4 col-md-offset-2">
          <div class="help-block" id="coinPrice" data-rate="{{setting('coin.cash_rate')}}" data-name="{{setting('coin.coin_name')}}">相当于{{classroom.price * setting('coin.cash_rate') }}{{setting('coin.coin_name')}}</div>
        </div>
      {% endif %}
      </div>

      {% if setting('vip.enabled') %}

      <div class="form-group">
        <div class="col-md-2 control-label">
          <label for="price">会员免费学</label>
        </div>
        <div class="col-md-8 controls">
          <select name="vipLevelId" class="form-control width-input width-input-large">
            {{ select_options(levels, classroom.vipLevelId|default(0), '不支持') }}
          </select>
        </div>
      </div>
      {% endif %}

      <div class="row form-group">
        <div class="col-md-2 control-label"></div>
        <div class="controls col-md-8">
          <button type="submit" class="btn btn-primary" id="classroom-save">提交</button>  
        </div>
      </div>

      <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
  </form>

  </div>
</div>
{% endblock %}